/*
 * ImportSources module for Netbeans.
 *
 * Copyright (c) 2007, Rogue
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * 
 * For queries or bugs, you may contact me via e-mail: roguexz [at] gmail [dot] com
 */
package rogue.netbeans.module.importsources;

import org.netbeans.api.project.ui.OpenProjects;

import org.openide.WizardDescriptor;

import rogue.netbeans.module.importsources.ui.WizardPanel3UI;

import java.awt.Component;

/**
 * @author Rogue
 */
public class WizardPanel3 extends AbstractWizardPanel {
    private WizardDescriptor wd = null;
    private WizardPanel3UI component = null;

    public boolean isPanelProcessingComplete() {
        return true;
    }

    public void terminateProcessing() {
        //NO-OP
    }

    public Component getComponent() {
        if (component == null) {
            component = new WizardPanel3UI();
        }

        return component;
    }

    public void readSettings(Object object) {
        component.setProjects(OpenProjects.getDefault().getOpenProjects());
    }

    public void storeSettings(Object object) {
        if (object instanceof WizardDescriptor) {
            WizardDescriptor wd = (WizardDescriptor) object;
            wd.putProperty(ImportSourcesConstants.SELECTED_PROJECT.toString(),
                           component.getSelectedProject());
            wd.putProperty(ImportSourcesConstants.SELECTED_SOURCE_GROUP.toString(),
                           component.getSelectedSourceGroup());
        }
    }

    public boolean isValid() {
        return true;
    }
}
